home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / fastkey.exe / DEMO2.PAS < prev    next >
Pascal/Delphi Source File  |  1992-12-11  |  1KB  |  35 lines

  1. Program Demo2;
  2.  
  3. {***************************************************************************
  4. Purpose:  To demonstrate the advantages of FASTKEY over the standard method
  5.           of checking the keyboard.
  6. ***************************************************************************}
  7.  
  8. Uses
  9.   Crt,FastKey;
  10.  
  11. Const
  12.   Y = 20;
  13.  
  14. Var
  15.   X                    { Current location of the "ship" }
  16.          : Integer;
  17.  
  18. Begin
  19.   ClrScr;
  20.   writeln ('FastKey Demonstration - After FastKey is installed.  Press Esc to exit.');
  21.   X := 40;                                  { set initial location of ship }
  22.   InstallFastKey;                           { prepare to use FastKey }
  23.   repeat
  24.     GotoXY(X,Y);  write('X');               { display the ship }
  25.     if Pressed(FKLeft) and not Pressed(FKRight) then Begin
  26.       GotoXY(X,Y);  write(' ');             { erase the ship }
  27.       if X > 1 then Dec(X);                 { update ship location }
  28.     End else if Pressed(FKRight) and not Pressed(FKLeft) then Begin
  29.       GotoXY(X,Y);  write(' ');             { erase the ship }
  30.       if X<80 then Inc(X);                  { update location of ship }
  31.     End;
  32.   until Pressed(FKEsc);
  33.   UnInstallFastKey;                         { remove FastKey from memory }
  34.   Clrscr;
  35. End. {Demo 2}